var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2AudioManager = require("AudioManager");
var $2DataManager = require("DataManager");
var $2ZombieMgr = require("ZombieMgr");
var $2KDefine = require("KDefine");
var $2TombStone = require("TombStone");
var $2PlantBase = require("PlantBase");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_Plant4 = /* */function (_c$default3) {
  babel_inherits(u, _c$default3);
  var _super67 = babel_createSuper(u);
  function u() {
    babel_classCallCheck(this, u);
    return _super67.apply(this, arguments);
  }
  babel_createClass(u, [{
    key: "shoot",
    value: function shoot() {
      var _this146 = this;
      if (0 == this.remainCD) {
        var _e72 = this;
        var _t45 = this.dragon.setAnimation(0, "dazhao", false);
        $2AudioManager.default.instance.playEffect(this.skillSound, this.skillSoundVolume);
        this.dragon.setCompleteListener(function () {
          _e72.setState($2KDefine.State.wait);
          _this146.attackTimes += _this146.attackCD;
          _this146.remainCD = _this146.skillCD;
        });
        this.dragon.setTrackEventListener(_t45, function (e, t) {
          if ("dazhao" == t.data.name) {
            for (var _a31 = 0; _a31 < $2DataManager.default.instance.col; _a31++) {
              $2DataManager.default.instance.blockArr[_this146.row][_a31][1] && $2DataManager.default.instance.blockArr[_this146.row][_a31][1].getComponent($2TombStone.default) && $2DataManager.default.instance.blockArr[_this146.row][_a31][1].x > _this146.node.x && $2DataManager.default.instance.blockArr[_this146.row][_a31][1].x - _this146.node.x < $2DataManager.default.instance.blockWidth * (_this146.attDistance + .5) && $2DataManager.default.instance.blockArr[_this146.row][_a31][1].getComponent($2TombStone.default).hurt(_this146.damage, _this146.bulletId, 1);
            }
            $2AudioManager.default.instance.playEffect(_this146.hitSound, _this146.hitSoundVolume);
            var _e73 = $2ZombieMgr.default.instance().zombieInRow[_this146.row].values();
            var _t46 = _e73.next();
            for (; !_t46.done;) {
              var _a32 = _t46.value;
              if (_a32.hp > 0 && _a32.node.x - _this146.node.x > 0 && _a32.node.x - _this146.node.x < $2DataManager.default.instance.blockWidth * (_this146.attDistance + .5)) {
                if (16 != _a32.id || 7 != _this146.id && 17 != _this146.id) {
                  _a32.hurt(_this146.damage, _this146.bulletId, 1);
                } else {
                  _a32.hurt(_this146.damage, _this146.bulletId, 1, 0, 0, true);
                }
              }
              _t46 = _e73.next();
            }
          }
        });
      } else {
        var _e74 = this;
        var _t47 = this.dragon.setAnimation(0, "gongji", false);
        $2AudioManager.default.instance.playEffect(this.shootSound, this.shootSoundVolume);
        this.dragon.setCompleteListener(function () {
          _e74.setState($2KDefine.State.wait);
        });
        this.dragon.setTrackEventListener(_t47, function (e, t) {
          if ("gongji" == t.data.name) {
            $2AudioManager.default.instance.playEffect(_this146.hitSound, _this146.hitSoundVolume);
            for (var _a33 = 0; _a33 < $2DataManager.default.instance.col; _a33++) {
              $2DataManager.default.instance.blockArr[_this146.row][_a33][1] && $2DataManager.default.instance.blockArr[_this146.row][_a33][1].getComponent($2TombStone.default) && $2DataManager.default.instance.blockArr[_this146.row][_a33][1].x > _this146.node.x && $2DataManager.default.instance.blockArr[_this146.row][_a33][1].x - _this146.node.x < $2DataManager.default.instance.blockWidth * (_this146.attDistance + .5) && $2DataManager.default.instance.blockArr[_this146.row][_a33][1].getComponent($2TombStone.default).hurt(_this146.damage, _this146.bulletId, 1);
            }
            var _e75 = $2ZombieMgr.default.instance().zombieInRow[_this146.row].values();
            var _t48 = _e75.next();
            for (; !_t48.done;) {
              var _a34 = _t48.value;
              if (_a34.hp > 0 && _a34.node.x - _this146.node.x > 0 && _a34.node.x - _this146.node.x < $2DataManager.default.instance.blockWidth * (_this146.attDistance + .5)) {
                if (16 != _a34.id || 7 != _this146.id && 17 != _this146.id) {
                  _a34.hurt(_this146.damage, _this146.bulletId, 1);
                } else {
                  _a34.hurt(_this146.damage, _this146.bulletId, 1, 0, 0, true);
                }
              }
              _t48 = _e75.next();
            }
          }
        });
        this.attackTimes += this.attackCD;
      }
    }
  }, {
    key: "checkTarget",
    value: function checkTarget() {
      var e = $2ZombieMgr.default.instance().zombieInRow[this.row];
      if (e.size <= 0) {
        return false;
      }
      var t = e.values();
      var a = t.next();
      for (; !a.done;) {
        var _e76 = a.value;
        if (_e76.hp > 0 && _e76.node.x - this.node.x > 0 && _e76.node.x - this.node.x < $2DataManager.default.instance.blockWidth * (this.attDistance + .5)) {
          return true;
        }
        a = t.next();
      }
      return false;
    }
  }]);
  return u;
}($2PlantBase.default);
def_Plant4 = cc__decorate([ccp_ccclass], def_Plant4);
exports.default = def_Plant4;